package com.sardine.base.hbase.persister;

import com.sardine.base.hbase.constants.IdGeneratorEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * 上海京东到家元信信息技术有限公司<br>
 * Created with IntelliJ IDEA.
 * Date:2017/11/23
 * Time:10:37
 * Hbase entity 的骨架信息
 * @author daifeng<br>
 *         daifeng@imdada.cn
 * @since JDK 1.7 <br>
 * Copyright (c) 2017 imdada System Incorporated All Rights Reserved.
 */
public class HEntitySkeleton<T> {
    private static final Logger logger = LoggerFactory.getLogger(HEntitySkeleton.class);
    /**
     * 类名称
     */
    private Class<T> className;
    /**
     * 表名称
     */
    private String tableName;

    /**
     * 行健值
     */
    private FiledDesc rowKey;

    /**
     * 行健策略
     */
    private IdGeneratorEnum generatorEnum;

    /**
     * 属性信息
     */
    private List<FiledDesc> filedDescList = new ArrayList<>();

    public Class<T> getClassName() {
        return className;
    }

    public void setClassName(Class<T> className) {
        this.className = className;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public FiledDesc getRowKey() {
        return rowKey;
    }

    public void setRowKey(FiledDesc rowKey) {
        this.rowKey = rowKey;
    }

    public IdGeneratorEnum getGeneratorEnum() {
        return generatorEnum;
    }

    public void setGeneratorEnum(IdGeneratorEnum generatorEnum) {
        this.generatorEnum = generatorEnum;
    }

    public List<FiledDesc> getFiledDescList() {
        return filedDescList;
    }

    public void setFiledDescList(List<FiledDesc> filedDescList) {
        this.filedDescList = filedDescList;
    }

    /**
     * 属性描述内部类
     */
    static class FiledDesc {
        //属性类型
        private String type;
        //列名称
        private String qualifier;
        //属性名称
        private String fieldName;
        //属性的列族名称
        private String columnFamily;
        /**
         * 映射反射属性值
         */
        private Field filed;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getQualifier() {
            return qualifier;
        }

        public void setQualifier(String qualifier) {
            this.qualifier = qualifier;
        }

        public String getFieldName() {
            return fieldName;
        }

        public void setFieldName(String fieldName) {
            this.fieldName = fieldName;
        }

        public String getColumnFamily() {
            return columnFamily;
        }

        public void setColumnFamily(String columnFamily) {
            this.columnFamily = columnFamily;
        }

        public Field getFiled() {
            return filed;
        }

        public void setFiled(Field filed) {
            this.filed = filed;
        }
    }
}
